{{Extend "layout"}}
{{Block "title"}}{{if HasSuffix URL.Path "_add"}}{{"添加订单"|T}}{{else}}{{"修改订单"|T}}{{end}}{{/Block}}
{{Block "breadcrumb"}}
{{Super}}
<li><a href="__BACKEND__/official/pay/order_index">{{"订单管理"|T}}</a></li>
<li class="active">{{if HasSuffix URL.Path "_add"}}{{"添加"|T}}{{else}}{{"修改"|T}}{{end}}</li>
{{/Block}}
{{Block "head"}}
<link rel="stylesheet" type="text/css" href="__ASSETS__/js/selectpage/selectpage.css" />
{{/Block}}
{{Block "main"}}
<div class="row">
    <div class="col-md-12">
        <div class="block-flat">
          <div class="header">							
            <h3>{{if HasSuffix URL.Path "_add"}}{{"添加订单"|T}}{{else}}{{"修改订单"|T}}{{end}}</h3>
          </div>
          <div class="content">
              <form class="form-horizontal group-border-dashed" parsley-validate novalidate method="POST" action="">
              <div class="form-group">
                <label class="col-sm-2 control-label">{{"选择客户"|T}}</label>
                <div class="col-sm-8">
                  {{$customerId := (Formx "customerId").Uint64}}
                  <input type="text" name="customerId" id="customerId" data-init="{{$customerId}}" value="{{$customerId}}" class="form-control">
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">{{"选择二维码"|T}}</label>
                <div class="col-sm-8">
                  {{$qrcodeId := (Formx "qrcodeId").Uint64}}
                  <input type="text" name="qrcodeId" id="qrcodeId" data-init="{{$qrcodeId}}" value="{{$qrcodeId}}" class="form-control">
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">{{"订单标题"|T}}</label>
                <div class="col-sm-8">
                    <input type="text" class="form-control" name="title" value="{{Form "title"}}">
                </div>
              </div>
              <div class="form-group">
                  <label class="col-sm-2 control-label">{{"支付方式"|T}}</label>
                  <div class="col-sm-8">
                    {{$v := Form "type"}}
                    <div class="radio radio-primary radio-inline">
                        <input type="radio" value="alipay" name="type" id="type-alipay"{{if or (eq $v "alipay") (eq $v "")}} checked{{end}}> <label for="type-alipay">{{"支付宝"|T}}</label>
                    </div>
                      <div class="radio radio-primary radio-inline">
                        <input type="radio" value="wechat" name="type" id="type-wechat"{{if eq $v "wechat"}} checked{{end}}> <label for="type-wechat">{{"微信"|T}}</label>
                      </div>
                      <div class="radio radio-primary radio-inline">
                        <input type="radio" value="other" name="type" id="type-other"{{if eq $v "other"}} checked{{end}}> <label for="type-other">{{"其它"|T}}</label>
                      </div>
                  </div>
                </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">{{"订单价格"|T}}</label>
                <div class="col-sm-8">
                    <input type="number" class="form-control" name="price" value="{{Form "price"}}" min="0.00">
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">{{"实付价格"|T}}</label>
                <div class="col-sm-8">
                    <input type="number" class="form-control" name="realPrice" value="{{Form "realPrice"}}" min="0.00">
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">{{"外部单号"|T}}</label>
                <div class="col-sm-8">
                    <input type="text" class="form-control" name="outOrderId" value="{{Form "outOrderId"}}">
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">{{"扩展数据"|T}}</label>
                <div class="col-sm-8">
                    <input type="text" class="form-control" name="extend" value="{{Form "extend"}}">
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">{{"通知网址"|T}}</label>
                <div class="col-sm-8">
                    <input type="url" class="form-control" name="notifyUrl" value="{{Form "notifyUrl"}}">
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">{{"返回网址"|T}}</label>
                <div class="col-sm-8">
                    <input type="url" class="form-control" name="returnUrl" value="{{Form "returnUrl"}}">
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">{{"说明"|T}}</label>
                <div class="col-sm-8">
                  <textarea class="form-control" name="description">{{Form "description"}}</textarea>
                </div>
              </div>
              <div class="form-group">
                  <label class="col-sm-2 control-label">{{"状态"|T}}</label>
                  <div class="col-sm-8">
                    {{$v := Form "status"}}
                    <div class="radio radio-primary radio-inline">
                        <input type="radio" value="inprogress" name="status" id="status-inprogress"{{if or (eq $v "inprogress") (eq $v "")}} checked{{end}}> <label for="status-inprogress">{{"未支付"|T}}</label>
                    </div>
                      <div class="radio radio-primary radio-inline">
                        <input type="radio" value="expired" name="status" id="status-expired"{{if eq $v "expired"}} checked{{end}}> <label for="status-expired">{{"已过期"|T}}</label>
                      </div>
                      <div class="radio radio-primary radio-inline">
                        <input type="radio" value="paid" name="status" id="status-paid"{{if eq $v "paid"}} checked{{end}}> <label for="status-paid">{{"已付款,未通知"|T}}</label>
                      </div>
                      <div class="radio radio-primary radio-inline">
                        <input type="radio" value="unsettled" name="status" id="status-unsettled"{{if eq $v "unsettled"}} checked{{end}}> <label for="status-unsettled">{{"通知失败"|T}}</label>
                      </div>
                      <div class="radio radio-primary radio-inline">
                        <input type="radio" value="settled" name="status" id="status-settled"{{if eq $v "settled"}} checked{{end}}> <label for="status-settled">{{"已完成"|T}}</label>
                      </div>
                  </div>
                </div>
              <div class="form-group form-submit-group">
									<div class="col-sm-9 col-sm-offset-2">
									  <button type="submit" class="btn btn-primary btn-lg"><i class="fa fa-save"></i> {{"保存"|T}}</button>
									  <button type="reset" class="btn btn-default btn-lg"><i class="fa fa-refresh"></i> {{"重置"|T}}</button>
									</div>
							</div>
            </form>
          </div><!-- /.content -->
        </div><!-- /.block-flat -->
    </div>
</div>
{{/Block}}
{{Block "footer"}}
<script src="__ASSETS__/js/selectpage/selectpage.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
  $('#customerId').selectPage({
    showField : 'name',
    keyField : 'id',
    data : BACKEND_URL+'/official/customer_index',
    params : function(){return {};},
    eAjaxSuccess : function(d){
        var result;
        if(d) result = {
          "list":d.Data.listData,
          "pageSize": d.Data.pagination.limit,
          "pageNumber": d.Data.pagination.page,
          "totalRow": d.Data.pagination.rows,
          "totalPage":d.Data.pagination.pages
        };
        else result = undefined;
        return result;
    }
  });
  $('#qrcodeId').selectPage({
    showField : 'name',
    keyField : 'id',
    data : BACKEND_URL+'/official/pay/qrcode_index',
    params : function(){return {};},
    eAjaxSuccess : function(d){
        var result;
        if(d) result = {
          "list":d.Data.listData,
          "pageSize": d.Data.pagination.limit,
          "pageNumber": d.Data.pagination.page,
          "totalRow": d.Data.pagination.rows,
          "totalPage":d.Data.pagination.pages
        };
        else result = undefined;
        return result;
    }
  });
});
</script>
{{/Block}}